//Stephen Erb Application GUI

import javax.swing.*;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;

public class AdvisorFieldDocumentFilter extends DocumentFilter{
    public AdvisorFieldDocumentFilter() {
        super();
    }
    @Override
    public void replace(FilterBypass fb, int os, int l, String temp, AttributeSet attrib) throws BadLocationException{
        for(int i=temp.length();i>0;i--) 
        {
            char tempChar=temp.charAt(i-1);
            if((tempChar>='A' && tempChar<='Z')||(tempChar>='a'&&tempChar<='z') || tempChar==' ') 
            {
                super.replace(fb,os,l,String.valueOf(tempChar),attrib);
            }
            else 
            {
                System.out.println("Nope");
            }
        }
    }
    @Override
    public void remove(FilterBypass fb, int firstInt, int secondInt)throws BadLocationException {
        super.remove(fb,firstInt,secondInt);
    }
    @Override
    public void insertString(FilterBypass fb, int firstInt, String temp,AttributeSet attrib)throws BadLocationException {
        super.insertString(fb,firstInt,temp,attrib);
    }
}